/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/cat.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#include "../import/head.h"
#include "../impl/head.h"
#include "jsp_functions.h"
#include "page.h"

//---------------------------------------------------------------------------------------------------------------------------------------------c++ declare begin
    const char * jsp_path = "/8080/www.cat.com/root/jsp";
    const char * jsp_id = "main.xos";
//---------------------------------------------------------------------------------------------------------------------------------------------c++ declare end
//---------------------------------------------------------------------------------------------------------------------------------------------c++ declare begin
    int get_result( int nData )
    {
        int ret = 0;
        ret = 2 * nData;
        return ret;
    }
//---------------------------------------------------------------------------------------------------------------------------------------------c++ declare end
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////page render function begin
void page_render( http::i_task * pTask,
    http::i_request * pRequest,
    http::i_response * pResponse,
    xos_box::i_str_property * pReqTag,
    xos_box::i_str_property * pResTag )
{
    using namespace xos_jsp;
    html_to_html( pTask, g_strHtmlBuf[0] );
    //-----------------------------------------------------------------------------------------------------------------------------------------c++ begin
    const char * g_head = "head";
    const char * g_foot = "foot";

    const char * g_app = "mywebsite";
    const char * g_name = "ghh";
	const char * g_poem = "\
白日依山近，黄河入海流。aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<br/>\r\n\
欲穷千里目，更上一层楼。<br/>\r\n\
白日依山近，黄河入海流。<br/>\r\n\
欲穷千里目，更上一层楼。<br/>\r\n\
白日依山近，黄河入海流。<br/>\r\n\
欲穷千里目，更上一层楼。<br/>\r\n\
白日依山近，黄河入海流。<br/>\r\n\
欲穷千里目，更上一层楼1。\
";
    //-----------------------------------------------------------------------------------------------------------------------------------------c++ end
    html_to_html( pTask, g_strHtmlBuf[2] );
    //-----------------------------------------------------------------------------------------------------------------------------------------c++ begin
	const char * http_url = pReqTag->str( "http_url" );
	const char * name = "高海辉";
    //-----------------------------------------------------------------------------------------------------------------------------------------c++ end
    html_to_html( pTask, g_strHtmlBuf[4] );
    variable_to_html( pTask, g_head );
    html_to_html( pTask, g_strHtmlBuf[6] );
    supper_variable_to_html( pTask, "request.tags.http_url" );
    html_to_html( pTask, g_strHtmlBuf[8] );
    supper_variable_to_html( pTask, "http_url" );
    html_to_html( pTask, g_strHtmlBuf[10] );
    variable_to_html( pTask, http_url );
    html_to_html( pTask, g_strHtmlBuf[12] );
    variable_to_html( pTask, g_poem );
    html_to_html( pTask, g_strHtmlBuf[14] );
    variable_to_html( pTask, g_app );
    html_to_html( pTask, g_strHtmlBuf[16] );
    variable_to_html( pTask, g_name );
    html_to_html( pTask, g_strHtmlBuf[18] );
    variable_to_html( pTask, name );
    html_to_html( pTask, g_strHtmlBuf[20] );
    variable_to_html( pTask, g_foot );
    html_to_html( pTask, g_strHtmlBuf[22] );
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////page render function end

const int g_jsp_body_num = 23;
std::string g_strHtmlBuf[g_jsp_body_num];
const char * g_pszBase64Html[g_jsp_body_num] = 
{
    "PCFET0NUWVBFIGh0bWw+DQoNCg==",
    0,
    "DQoNCg==",
    0,
    "DQo8aHRtbD4NCiAgPGhlYWQ+DQogICAgPG1ldGEgY2hhcnNldD0idXRmLTgiPg0KICAJPGxpbmsgdHlwZT0idGV4dC9jc3MiIHJlbD0ic3R5bGVzaGVldCIgaHJlZj0iLi4vLi4vaHRtbC9jc3Mvd2ViLmNzcyI+DQogIAk8dGl0bGU+bWFpbjwvdGl0bGU+DQogIDwvaGVhZD4NCiAgDQogIDxib2R5Pg0KICAgIDxpbWcgc3JjPSIuLi8uLi9odG1sL2ltZy9mbG93ZXIuanBnIiBib3JkZXI9IjAiIHdpZHRoPTEwMCUgaGVpZ2h0PTIxM3B4Pg0KICAgIDxhIGhyZWY9Ii4uLy4uL2h0bWwvYmFpZHUuaHRtIj7nmb7luqY8L2E+PGJyLz4NCiAgICA8YSBocmVmPSIuLi8uLi9odG1sL3Rlc3QuaHRtIj5vZ3JlPC9hPg0KICAgICAgICA8cD4NCgkgICAgaGVhZCA9IA==",
    0,
    "PGJyLz4NCiAgICA8L3A+DQoNCiAgICBzdXBwZXIgdmFyaWFibGUsIHVybCA9IA==",
    0,
    "PGJyLz4NCiAgICBzdXBwZXIgdmFyaWFibGUsIHVybCA9IA==",
    0,
    "PGJyLz4NCgk8cD4=",
    0,
    "PC9wPg0KCTxwPmEgcG9lbSA6IDwvcD4NCgk8cD4=",
    0,
    "PC9wPg0KCWdhcHAgOiA=",
    0,
    "PGJyLz4NCglnbmFtIDog",
    0,
    "PGJyLz4NCgluYW1lIDog",
    0,
    "PGJyLz4NCiAgCTxkaXYgaWQ9ImNvbnRhaW5lciI+DQogICAgICAgICAgPGRpdiBpZD0iYmFubmVyIj5iYW5uZXI8L2Rpdj4NCiAgICAgICAgICA8ZGl2IGlkPSJsaW5rIj5saW5rPC9kaXY+DQogICAgICAgICAgPGRpdiBpZD0iY29udGVudCI+Y29udGVudDwvZGl2Pg0KICAgICAgICAgIDxkaXYgaWQ9ImZvb3RlciI+Zm9vdGVyPC9kaXY+DQogIAk8L2Rpdj4NCiAgICAgICAgPHA+DQoJICAgIGZvb3QgPSA=",
    0,
    "PGJyLz4NCiAgICA8L3A+DQoNCiAgPC9ib2R5Pg0KPC9odG1sPg0K"
};
